{% extends "base.html" %}


{% block title %}{% if group %}{{ group.title }}{% else %}Groups{% endif %}{% endblock %}
{% block body_class %}groups{% endblock %}


{% block content_title %}
  {% load groups %}

  {% if group %}
    <h2><a href="{{ group.get_absolute_url }}">{{ group }}</a> {% block group_title %}{% endblock %}</h2>
    <ul>
      <li class="activity"><a href="{% url groups:group group.slug %}">Activity</a></li>
      <li class="members"><a href="{% url groups:members group.slug %}">Members</a></li>
      <li class="topics"><a href="{% url groups:topics group.slug %}">Topics</a></li>
      {% for page in group.pages.all %}
        <li class="{{ page.slug }}"><a href="{{ page.get_absolute_url }}">{{ page.title }}</a></li>
      {% endfor %}
      {% if group|is_owner:user %}
        <li><a class="edit" href="{% url groups:edit group.slug %}">Edit group</a></li>
      {% endif %}
      {% if not group|is_member:user %}
        <li><a href="{% url groups:join group.slug %}">Join</a></li>
      {% endif %}
    </ul>
  {% endif %}
{% endblock %}